package com.skaz;

import com.skaz.util.Envs;

import javax.servlet.http.HttpServletResponse;

/**
 * @Author: jungle
 * @Date: 2018/11/7 3:52 PM
 */
public class Constants {

    public static final String SECURITY_SECRET = "aaa";

    public static final String SECURITY_HEADER = "token";


    public static final String PROFILE_DEV = "dev";
    public static final String PROFILE_TEST = "test";
    public static final String PROFILE_PROD = "prod";
    public static final String PROFILE_SHOW = "show";
    public static final String PROFILE_DEFAULT = PROFILE_DEV;


    //
    // ERROR
    // -----------------------------------------------------------------------------------------------------------------
    public static final int ERROR_STATUS_401 = HttpServletResponse.SC_UNAUTHORIZED;
    public static final String ERROR_STATUS_401_MSG = "您没有权限进行访问.";
    public static final String ERROR_STATUS_401_EXPIRED_MSG = "您的登录信息已失效,请重新登录.";
    public static final int ERROR_STATUS_403 = HttpServletResponse.SC_FORBIDDEN;
    public static final String ERROR_STATUS_403_MSG = ERROR_STATUS_401_MSG;
    public static final int ERROR_STATUS_404 = HttpServletResponse.SC_NOT_FOUND;
    public static final String ERROR_STATUS_404_MSG = "找不到该服务或服务未提供.";
    public static final int ERROR_STATUS_500 = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    public static final String ERROR_STATUS_500_MSG = "服务内部发生错误,请稍后再试.";


    public static final boolean MYCAT_DBTYPE_SLAVE = Envs.getBoolean("app.mycat.slave", true);
    public static final String MYCAT_DBTYPE_SLAVE_SQL = MYCAT_DBTYPE_SLAVE ? "/*#mycat:db_type=slave*/" : "/**/";


    public static final int    PAGE_NO          = Envs.getInteger("app.page.no", 1);
    public static final int    PAGE_SIZE        = Envs.getInteger("app.page.size", 20);
}
